def download():
	with open('yyascp.sh','w') as f:
		for k in range(191393,191638):
			ascp='ascp -QT -l 100M -i ~/.aspera/connect/etc/asperaweb_id_dsa.openssh anonftp@ftp-private.ncbi.nlm.nih.gov:/sra/sra-instant/reads/ByStudy/sra/SRP/SRP006/SRP006574/SRR'+str(k)+'/SRR'+str(k)+'.sra ./SRR'+str(k)+'.sra'
			f.write(ascp+'\n')

#ls *.sra >haddownload.txt
def downloadfailed():
	fd=[]
	with open('D:\\cross_talk\\GSE84465\\fastq.txt') as nf:
		for line in nf.readlines():
			#srr=line.strip('_2.fastq\n').strip('SRR')
			srr=line.strip('\n')
			fd.append(srr)
	print (len(fd))

	notdown=[]
	with open('D:\\cross_talk\\GSE84465\\fastqdump.sh','w') as fw:
		for k in range(3934350,3937938):
			if str(k) not in fd:
				#ascp='ascp -QT -l 100M -i ~/.aspera/connect/etc/asperaweb_id_dsa.openssh anonftp@ftp-private.ncbi.nlm.nih.gov:/sra/sra-instant/reads/ByStudy/sra/SRP/SRP006/SRP006574/SRR'+str(k)+'/SRR'+str(k)+'.sra ./SRR'+str(k)+'.sra'
				#wget='wget ftp://ftp-trace.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByStudy/sra/SRP/SRP079/SRP079058/SRR'+str(k)+'/SRR'+str(k)+'.sra'
				#aria2='aria2c ftp://ftp-trace.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByStudy/sra/SRP/SRP079/SRP079058/SRR'+str(k)+'/SRR'+str(k)+'.sra'
				notdown.append(k)
				fastqdump='fastq-dump --split-3  SRR'+str(k)+'.sra'
				fw.write(fastqdump+'\n')
	print (len(notdown))





if __name__ == '__main__':
	downloadfailed()


#dos2unix downloadfailed.txt
#ftp://ftp-trace.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByStudy/sra/SRP/SRP079/SRP079058/SRR3934349/SRR3934349.sra